package shop.controller;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import shop.dao.IUsersDao;
import shop.model.Users;
import shop.service.IUsersService;
import shop.util.ResponseData;

@RestController
@RequestMapping("mall/users")
public class UsersController {
	@Resource
	private IUsersService service;
	@Resource
	private IUsersDao dao;
	
	@RequestMapping("login.do")
	public ResponseData login(Users u) {
		return new ResponseData("","","",service.login(u));
	}
	
	@RequestMapping("edit.do")
	public int edit(Users u) {
		return dao.edit(u);
	}
	
	@RequestMapping("findById.do")
	public Users findById(int id) {
		return dao.findById(id);
	}
	
	@RequestMapping("setDefaultAddress.do")
	public int setDefaultAddress(int addressId,int id) {
		return dao.setDefaultAddress(addressId,id);
	}
	
	@RequestMapping("getDefaultAddress.do")
	public int getDefaultAddress(int id) {
		return dao.getDefaultAddress(id);
	}

}
